# "1.点击“余额调整”按钮。
# 2.添加客户cyy,金额增加""10000"",备注内容“买手机用”
# 3.点击“提交充值”按钮。在前台查询cyy是否余额多10000."
import  time
from public.action import *
from public.testData import *
from public.tools import*
from public.business import *
testCase34='DBshop034_余额流程'
firefox=openBrowser(urlAdmin)
DBshopLoginAdmin(firefox)
DBshopEnterMenu2(firefox,'客户管理','管理客户')
firefox.find_element_by_xpath('//td[contains(.,"%s")]//following-sibling::td[7]/a[2]'%userName).click()# 轴定位到自己的账号
from selenium.webdriver.support.select import  Select
s1=firefox.find_element_by_id('money_change_type_1')
Select(s1).select_by_visible_text('增加')  #处理下拉框 选择增加
firefox.find_element_by_id('money_change_num').send_keys('10000') #金额增加10000

firefox.find_element_by_id('money_pay_info').send_keys('买手机用')

firefox.find_element_by_xpath('//button[text()="提交充值"]').click() #点击提交充值
firefox.quit()

#登录前台
firefox=openBrowser(url)
DBshopLogin(firefox,userName,password)

firefox.find_element_by_link_text('用户中心').click()

firefox.find_element_by_link_text('账户余额').click()#进入用户中心，账户余额
time.sleep(4)
try:
    firefox.find_element_by_xpath('//td[text()="买手机用"]').is_displayed()#断言买手机用这个字段
    writeLog('%s 测试通过'%testCase34)
except:
    writeLog('%s 测试失败'%testCase34)
    getPhoto(firefox)
firefox.quit()


